package com.qf.zyh.dao.Impl;

import com.qf.zyh.dao.TypeDao;
import com.qf.zyh.entity.Type;
import com.qf.zyh.util.DBUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class TypeDaoImpl implements TypeDao {
    QueryRunner qr = new QueryRunner();
    @Override
    public List<Type> getAll() {
        try {
            return qr.query(DBUtil.getConnection(),"select tid,tname,tinfo from type",new BeanListHandler<>(Type.class));
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
